{extend name="layout/layout" /}

{block name="pagecss"}
<link href="__STATIC__/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" />
{/block}

{block name="content"}
<div class="row">
    <div class="col-md-12">
        <div class="portlet light">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-share font-dark"></i>
                    <span class="caption-subject font-dark bold uppercase"> 新增调研</span>
                </div>
                <div class="actions">
                    <a class="btn btn-circle btn-icon-only btn-default fullscreen" href="javascript:;" data-original-title="" title=""> </a>
                </div>
            </div>
            <div class="portlet-body">
                <form id="ajax-form" class="form-horizontal" enctype="multipart/form-data">
                    {:token()}
                    <div class="form-body">
                        <div class="row" style="margin-bottom: 10px;">
                            <div class="col-md-9">
                                <div class="form-inline">
                                    <label class="control-label col-md-3">
                                        调研范围
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        {include file="common:selectarea" /}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        调研主题
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" id="name" maxlength="40" placeholder="最多输入40字" name="name" data-name="" value="" >
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        前言
                                    </label>
                                    <div class="col-md-9">
                                        <textarea class="form-control" name="preface" rows="3" maxlength="800"></textarea>
                                        <span class="help-block"> 最多800字符 </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        结语
                                    </label>
                                    <div class="col-md-9">
                                        <textarea class="form-control" name="epilogue" rows="3" maxlength="800"></textarea>
                                        <span class="help-block"> 最多800字符 </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        开始时间
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="text" class="form-control" id="startTime" name="startTime" value="" autocomplete="off">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        调研时长
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-4">
                                        <input type="number" class="form-control" maxlength="10" placeholder="" name="time" value="" >
                                    </div>
                                    <span class="help-inline">天</span>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-9">
                                <div class="form-group">
                                    <label class="control-label col-md-3">
                                        调研题目
                                        <span class="required">*</span>
                                    </label>
                                    <div class="col-md-9">
                                        <input type="hidden" class="projectIds" name="projectIds" value="" >
                                        <div class="project-div">
                                            <button type="button" class="btn btn-success addProject-btn" style="margin-top: 10px;">
                                                <i class="fa fa-plus"></i> 添加题目
                                            </button>
                                            <div class="portlet light" style="padding: 0">
                                                <div class="portlet-body">
                                                    <form action="" class="form-horizontal" name="ajaxForm">
                                                        <div class="">
                                                            <table id="project-datatable" class="table table-bordered table-hover dataTable">
                                                                <thead>
                                                                    <th>排序</th>
                                                                    <th>调研标题</th>
                                                                    <th>类型</th>
                                                                    <th>操作</th>
                                                                </thead>
                                                            </table>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <input type="hidden" class="id" name="id" value="">
                        <input type="hidden" class="researchId" name="researchId" value="{$researchId}">
                        <hr />

                        <div class="row">
                            <div class="form-actions">
                                <div class="col-md-offset-2 col-md-10">
                                    <button type="button" class="btn blue save-btn">
                                        保存 <i class="fa fa-floppy-o"></i>
                                    </button>
                                    <button type="button" class="btn default" onclick="history.go(-1);">
                                        返回 <i class="fa fa-mail-forward"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<!-- 详情 模态框 -->
<div class="modal fade" id="view-modal" data-backdrop="static" data-keyboard="false" >
    <div class="modal-dialog" style="width:800px; height: 520px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">x</button>
                <h4 class="modal-title">调研项目</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn blue saveProject-btn"> 确定 </button>
                <button type="button" class="btn default" data-dismiss="modal"> 关闭 </button>
            </div>
        </div>
    </div>
</div>

<input type="hidden" class="token_url" value="{:url('admin/Image/token')}">
<input type="hidden" class="record_url" value="{:url('admin/Image/record')}">
<input type="hidden" class="delimage_url" value="{:url('admin/Image/delete')}">

<input type="hidden" class="redirect_url" value="{:url('admin/'.strtolower($model).'/index')}">
<input type="hidden" class="save_url" value="{:url('admin/'.strtolower($model).'/savepost')}">
<input type="hidden" class="checkName_url" value="{:url('admin/'.strtolower($model).'/checkName')}">

<input type="hidden" class="projectDatalist_url" value="{:url('admin/'.strtolower($model).'/researchproject')}">
<input type="hidden" class="projectDelete_url" value="{:url('admin/'.strtolower($model).'/delproject')}">
<input type="hidden" class="viewProject_url" value="{:url('admin/'.strtolower($model).'/viewproject')}">
<input type="hidden" class="saveProject_url" value="{:url('admin/'.strtolower($model).'/saveproject')}">
<input type="hidden" class="checkProjectSorting_url" value="{:url('admin/'.strtolower($model).'/checkprojectsorting')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<script src="__STATIC__/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" type="text/javascript"></script>

<script src="__STATIC__/admin/pages/js/research.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/researchproject.js" type="text/javascript"></script>
{/block}